Skip to content

Generate one schema-correct migration for AMI and GCE image updates#37

Open
furkansahin wants to merge 1 commit into
mainfrom
fix-image-update-migration
Open

Generate one schema-correct migration for AMI and GCE image updates#37
furkansahin wants to merge 1 commit into
mainfrom
fix-image-update-migration

Conversation

@furkansahin

Copy link
Copy Markdown
Member

The GCE migration step filtered pg_gce_image on gcp_project_id, a
column that does not exist (the GCE project lives in clover config,
not the table), so every generated image-update PR failed
setup_database with PG::UndefinedColumn. The AWS and GCE updates were
also written as two separate migration files per run.

Merge the two steps into one that emits a single
update_postgres_images migration covering both tables. The
pg_gce_image update filters on arch alone, which uniquely identifies
the row. Previous GCE image names are discovered from earlier
migration files the same way old AMI ids already were, making the
GCE half reversible instead of raising unconditionally; the down
still raises if no prior name could be found. Empty inputs produce
empty arrays, so partial builds (AMI-only or GCE-only) generate a
valid no-op section instead of a missing file.

Verified by executing the generation script against the real clover
migrate directory: old-name discovery found the genuine 20260429-1-0
GCE images and existing AMI ids, and the emitted file passes ruby -c
and clover rubocop in both the populated and empty-input paths.

The GCE migration step filtered pg_gce_image on gcp_project_id, a
column that does not exist (the GCE project lives in clover config,
not the table), so every generated image-update PR failed
setup_database with PG::UndefinedColumn. The AWS and GCE updates were
also written as two separate migration files per run.

Merge the two steps into one that emits a single
update_postgres_images migration covering both tables. The
pg_gce_image update filters on arch alone, which uniquely identifies
the row. Previous GCE image names are discovered from earlier
migration files the same way old AMI ids already were, making the
GCE half reversible instead of raising unconditionally; the down
still raises if no prior name could be found. Empty inputs produce
empty arrays, so partial builds (AMI-only or GCE-only) generate a
valid no-op section instead of a missing file.

Verified by executing the generation script against the real clover
migrate directory: old-name discovery found the genuine 20260429-1-0
GCE images and existing AMI ids, and the emitted file passes ruby -c
and clover rubocop in both the populated and empty-input paths.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant